<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 * @author   howe <howe1995@163.com>
 */

namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;

class Group extends Model
{
    use SoftDeletes;

    /**
     * The attributes that are mass assignable.
     *
     * @var string[]
     */
    protected array $fillable = ['name', 'owner', 'notice_user', 'notice', 'noticed_at', 'setting'];

    protected array $casts = [
        'setting' => 'json',
    ];

    public function friend()
    {
        return $this->belongsTo(Friend::class, 'send_user', 'friend');
    }

    public function send()
    {
        return $this->belongsTo(User::class, 'send_user', 'id');
    }
}
